class Solution
{
public:
    long long numberOfWeeks(vector<int> &milestones)
    {
        long long sum = 0;
        long long m = 0;
        for (long long num : milestones)
        {
            sum += num;
            m = max(m, num);
        }
        if (2 * m <= sum + 1)
        {
            return sum;
        }
        return (sum - m) * 2 + 1;
    }
};